﻿using System;
using System.Resources;

namespace SystemX.WebControls.XPaging
{
	/// <summary>
	/// Recource reader utility
	/// </summary>
    internal sealed class ResReader
    {
        private static ResReader _loader = null;
        private static object _lock = new object();
        private ResourceManager _rm;

        private ResReader()
        {
            this._rm = new ResourceManager("SystemX.Assets.xPager", base.GetType().Assembly);
        }
		/// <summary>
		/// resource reader singleton.
		/// </summary>
        internal static ResReader Reader
        {
			get
            {
				if (_loader == null)
				{
					lock (_lock)
					{
						if (_loader == null)
						{
							_loader = new ResReader();
						}
					}
				}
				return _loader;
            }

        }

        public static string GetString(string name)
        {
            string str = null;
            if (Reader != null)
            {
                str = Reader.Resources.GetString(name, null);
            }
            return str;
        }

        private ResourceManager Resources
        {
            get
            {
                return this._rm;
            }
        }
    }
}

